<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <input type="text" v-model="a">
        <input type="text" v-model="b"> {{a+b}}
    </div>
</body>

<script src="./node_modules/vue/dist/vue.js"></script>
<!-- 可适用异步 -->
<script>
    new Vue({
        el: '#app',
        data: () => {
            return {
                a: 0,
                b: 0
            } 
        },
        methods: {

        },
        watch:{
            a(newVal,oldVal){
                console.log(`a的值从${oldVal}变成${newVal}`)
            }
        }
    })
</script>


</html>